CREATE TABLE [dbo].[T_BILL_DETAIL]
(
[BILL_DETAIL_ID] [bigint] NOT NULL IDENTITY(1, 1),
[BILL_ID] [bigint] NULL,
[PRODUCT_ID] [bigint] NULL,
[CREATE_DATE] [datetime] NOT NULL,
[DISABLE_DATE] [datetime] NULL,
[CUSTOMER_ID] [bigint] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[T_BILL_DETAIL] ADD CONSTRAINT [PK__T_BILL_D__0C4DEB5647B98209] PRIMARY KEY CLUSTERED  ([BILL_DETAIL_ID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[T_BILL_DETAIL] ADD CONSTRAINT [FK__T_BILL_DE__BILL___0D7A0286] FOREIGN KEY ([BILL_ID]) REFERENCES [dbo].[T_PRODUCT] ([PRODUCT_ID])
GO
ALTER TABLE [dbo].[T_BILL_DETAIL] ADD CONSTRAINT [FK__T_BILL_DE__BILL___5165187F] FOREIGN KEY ([BILL_ID]) REFERENCES [dbo].[T_BILL] ([BILL_ID])
GO
ALTER TABLE [dbo].[T_BILL_DETAIL] ADD CONSTRAINT [FK__T_BILL_DE__CUSTO__52593CB8] FOREIGN KEY ([CUSTOMER_ID]) REFERENCES [dbo].[T_CUSTOMER] ([CUSTOMER_ID])
GO
ALTER TABLE [dbo].[T_BILL_DETAIL] ADD CONSTRAINT [FK__T_BILL_DE__PRODU__0E6E26BF] FOREIGN KEY ([PRODUCT_ID]) REFERENCES [dbo].[T_PRODUCT] ([PRODUCT_ID])
GO
